package com.example.consumer_order_feign.Controller;

import com.example.consumer_order_feign.feign.UserFeign;
import com.example.consumer_order_feign.feign.UserFeignClient;
import com.example.consumer_order_feign.model.UserInf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class UserController {
    @Autowired
    private UserFeignClient userFeignClient;
    @Autowired
    private UserFeign userFeign;

    @RequestMapping("/order/getIpAndPort")
    @ResponseBody
    public String getIpAndPort(){
        String ipAndPort = userFeignClient.getIpAndPort();
        return ipAndPort;
    }

    @RequestMapping("/order/user/getById")
    @ResponseBody
    public UserInf getById(String id){
        return userFeign.getById(id);
    }


}
